studentHomeWork = function(){
	Ext.define('fileModel',{
		extend:'Ext.data.Model',
		fields:[ 
		        	{name:'fileId',type:'String'},
		        	{name:'studentId',type:'String'},
		        	{name:'teacherId',type:'string'},
		        	{name:'fileName',type:'string'},
		        	{name:'filePath',type:'String'},
			        {name:'uploadTime',type:'string'}
			      
			       ],
		idProperty : 'fileId'
	});
	

	var store = Ext.create('Ext.data.Store',{
		pageSize:100,
		model:fileModel,
		autoLoad:true,
		proxy:{
			type:'ajax',
			url:'queryHomeWorkFileAction.action',
			reader:{
				type:'json',
				root:'resultList.list',
				totalProperty:'resultList.total'
			}
		}
	});
	
	var checkBox = Ext.create('Ext.selection.CheckboxModel');
	var grid = Ext.create('Ext.grid.Panel',{
		store:store,	
		columnLines:true,
		selModel:checkBox,
		disableSelection:false,
		//width:600,
		id:"grid11",
		loadMask:true,
		columns:[
		         {text:'学号',width:100,dataIndex:'studentId',sortable:true,editor:{allowBlank : false}},
		         {text:'文件名称',width:500,dataIndex:'fileName',sortable:true,editor:{allowBlank : false}},
		         {text:'提交日期',width:100,dataIndex:'uploadTime',sortable:true,
		        	 renderer:function(v){
		        		 return v.replace("T"," ").substring(0,16);
		        		 }},
		        		 { 
				        	 header: '操作', 
				        	 xtype: 'actioncolumn', 
				        	 width: 100, 
				        	 items: ['->',{ 
				        	 iconCls: 'Arrowdown', 
				        	 tooltip: '下载', 
				        	 handler: function (grid, rowIndex, colIndex) { 
				        		 var rec = grid.getStore().getAt(rowIndex);
				        		 var fileId = rec.get('fileId');		       
				        		 window.location.href="downloadHomeWorkFileAction.action?fileID="+fileId;
				        	 	}
				        	 }
				        	 ] 

				        	 }
		         ],
		autoHeight:true,
		authWidth:true,

		title:"作业列表",
		loadMask:true,
		pageSize:5,
		dockedItems:[{
			dock:'top',
			xtype:'toolbar',
			//height:200,
			items:[/*{
				width:300,
				fieldLabel:'搜索',
				labelWidth:70,
				xtype:'searchfield',
				store:store			
			},*//*{
				xtype:'label',
				html:'<div style="font-size:12px;color:red">*支持学号的模糊查询</div>'
			},*//*{
					text:'上传作业',
					iconCls:'Add',
					xtype:'button',
					handler:function(){
						uploadWin();
					}
			},*/'->',{
				text:'批量删除',
				iconCls:'Decline',
				xtype:'button',
				handler:function(){
					
					deletes();
				}
		}]		
		},
		{
			dock:'bottom',
			xtype:'pagingtoolbar',	
			store:store,
			displayInfo:true,
			displayMsg:'显示{0}-{1}条，共计{2}条',
			emptyMsg:"没有数据"
		}/*,{
			dock:'bottom',
			xtype:'label',
			html:'<div style="font-size:12px;color:red">1.双击进行单行编辑&nbsp&nbsp2.编辑或新增后需要提交数据进行保存&nbsp&nbsp3.登录账号不能重复，输入后会验证</div>'
		}*/
		]
	});
	
	function deletes(){
		var data = grid.getSelectionModel().getSelection();  
	    if (data.length == 0) {  
	        Ext.Msg.alert("提示","请先选择要删除的行");  
	        return;  
	    } else {  
	        Ext.Msg.confirm("请确认", "是否真的要删除数据？", function(button, text) {  
	            if (button == "yes") {  
	                var fileIds = [];  
	                Ext.Array.each(data, function(record) {  
	                            var fileId=record.get('fileId');  
	                            //如果删除的是幻影数据，则id就不传递到后台了，直接在前台删除即可  
	                            if(fileId){  
	                            	fileIds.push(fileId);  
	                            } 
	                            else{
	                            	store.remove(record);
	                            }
	                        });
	                //Ext.Msg.alert(teacherIds);
	                if(fileIds.length==0){return;}
	                Ext.Ajax.request({  
	                    url : 'deleteHomeWorkFileAction.action',  
	                    params : {  
	                    	fileIds : fileIds.join(',')  
	                    },  
	                    method : 'POST',  
	                    success : function(response, opts) {  
	                        var success = Ext.decode(response.responseText).success;  
	                        // 当后台数据同步成功时  
	                        if (success) {  
	                           /* Ext.Array.each(data, function(record) {  
	                                        store.remove(record);// 页面效果  
	                                    });  */
	                        	Ext.Msg.alert("提示","删除成功！");
	                        	store.load();
	                        } else {  
	                        	Ext.Msg.alert("提示","删除失败！");
	                        }  
	                    }  
	                });  
	            }  
	        });  
	    }  
	}
	return grid;
}